package com.example.shop.tool;

import org.springframework.util.Assert;

import java.util.function.Supplier;

public interface ExceptionCodeSupplier extends Supplier<Integer> {
    default void check(int codeSuffix) {
        Assert.isTrue(codeSuffix >= 0, "错误码必须大于0, 且0表示成功调用, 请参考{@code StandardExceptionCode.SUCCESS}.");
        Assert.isTrue(codeSuffix <= 9999, "错误码后缀最大不超过9999");
    }
}